package com.example.activitylifedemo

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        Log.d("ActivityLife==>", "MainActivity,onCreate()")
        btn_main_activity.setOnClickListener {
            startActivity(Intent(MainActivity@this,MainActivity::class.java))
        }
        btn_second_activity.setOnClickListener {
            startActivity(Intent(MainActivity@ this, SecondActivity::class.java))
        }
        btn_third_activity.setOnClickListener {

            startActivity(Intent(MainActivity@ this, ThirdActivity::class.java))
        }
    }

    override fun onResume() {
        super.onResume()
        Log.d("ActivityLife==>", "MainActivity,onResume()")
    }

    override fun onStart() {
        super.onStart()
        Log.d("ActivityLife==>", "MainActivity,onStart()")
    }

    override fun onPause() {
        super.onPause()
        Log.d("ActivityLife==>", "MainActivity,onPause()")
    }

    override fun onStop() {
        super.onStop()
        Log.d("ActivityLife==>", "MainActivity,onStop()")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d("ActivityLife==>", "MainActivity,onDestroy()")
    }

    override fun onRestart() {
        super.onRestart()
        Log.d("ActivityLife==>", "MainActivity,onRestart()")
    }
}
